#include "Apple.h"

#include <stdlib.h>
#include <time.h>

//------------------------------------------------------------------------------

Apple::Apple() {
	choose();
}

//------------------------------------------------------------------------------

Apple::~Apple() {
}

//------------------------------------------------------------------------------

int Apple::getX() const {
	return x;
}

//------------------------------------------------------------------------------

int Apple::getY() const {
	return y;
}

//------------------------------------------------------------------------------

void Apple::choose() {
	 srand( time(NULL) );
	 x = rand() % (WIDTH-2)+1;
	 y = rand() % (HEIGHT-2)+1;
}

//------------------------------------------------------------------------------

bool Apple::check( const Snake& snake ) {
	if( snake.getX() == x && snake.getY() == y )
		return true;

	return false;
}

//------------------------------------------------------------------------------
